from fastapi import HTTPException
from typing import Any

from common.response.response_code import (
    CustomErrorCode, HttpCode
)

class CustomException(Exception):
    def __init__(
        self, 
        msg: str = None, 
        code: int = HttpCode.HTTP_400
    ) -> None:
        self.code = code
        self.msg = msg
        
class HTTPError(HTTPException):
    def __init__(
        self, 
        *, 
        code: int, 
        msg: Any = None, 
        headers: dict[str, Any] | None = None
    ):
        super().__init__(status_code=code, detail=msg, headers=headers)
        
        
class ServerNotFound(CustomException):
    def __init__(
        self, 
        msg: str, 
    ):
        super().__init__(msg, HttpCode.HTTP_404)
        
class ServerInputError(CustomException):
    def __init__(
        self, 
        msg: str, 
    ):
        super().__init__(msg, HttpCode.HTTP_400)
        
class ServerForbidden(CustomException):
    def __init__(
        self, 
        msg: str, 
    ):
        super().__init__(msg, HttpCode.HTTP_403)
        
class ServerNotAuthorized(CustomException):
    def __init__(
        self, 
        msg: str, 
    ):
        super().__init__(msg, HttpCode.HTTP_401)
        
class ServerConflict(CustomException):
    def __init__(
        self, 
        msg: str, 
    ):
        super().__init__(msg, HttpCode.HTTP_409)
        
class ServerError(CustomException):
    def __init__(
        self, 
        msg: str, 
    ):
        super().__init__(msg, HttpCode.HTTP_500)